﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title></title>
    <style>
    #map
    {
    	height:430px;
    	width:600px;
    }
    </style>
  
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="google-maps-3-vs-1-0.js"> </script>
    <script type="text/javascript">
        var map = null;
        var geocoder = null;
        function ShowMap() {
            // Creating a reference to the mapDiv
            var mapDiv = document.getElementById('map');
            var latlng = new google.maps.LatLng(13.8479107, 106.7746639);
            var options = {
                center: latlng,
                zoom: 5,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            // Creating the map
            map = new google.maps.Map(mapDiv, options);
            geocoder = new google.maps.Geocoder();
        }
        function codeAddress() {
            //var address = document.getElementById("txtaddress").value;
            var address = "121 Đường Nguyễn Huệ, Phường Bến Nghé, Quận 1, Thành Phố Hồ Chí Minh";
            geocoder.geocode({ 'address': address }, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    map.setCenter(results[0].geometry.location);

                    var marker = new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location

                    });
                    alert(results[0].geometry.location);
                } else {
                    alert("Geocode was not successful for the following reason: " + status);
                }
            });
        }


    </script>
	</head>
	<body style="background-color:Black; margin:0;" onload="ShowMap();">
	    <div id="map"></div>
	</body>
</html>